<?php include_once './header.php'; ?>
<?php 
include('config.php'); 
if (isset($_GET['idContacto']) ) { 
$idContacto = (int) $_GET['idContacto']; 
if (isset($_POST['submitted'])) { 
foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } 
$sql = "UPDATE `contacto` SET  `nombreContacto` =  '{$_POST['nombreContacto']}' ,  `apellidoContacto` =  '{$_POST['apellidoContacto']}' ,  `emailContacto` =  '{$_POST['emailContacto']}' ,  `telefonoContacto` =  '{$_POST['telefonoContacto']}' ,  `paisContacto` =  '{$_POST['paisContacto']}'   WHERE `idContacto` = '$idContacto' "; 
mysql_query($sql) or die(mysql_error()); 
echo (mysql_affected_rows()) ? "Edited row.<br />" : "Nothing changed. <br />"; 
echo "<a href='listCli.php'>Back To Listing</a>"; 
} 
$row = mysql_fetch_array ( mysql_query("SELECT * FROM `contacto` WHERE `idContacto` = '$idContacto' ")); 
?>

<form action='' method='POST'> 
<p><b>NombreContacto:</b><br /><input type='text' name='nombreContacto' value='<?= stripslashes($row['nombreContacto']) ?>' /> 
<p><b>ApellidoContacto:</b><br /><input type='text' name='apellidoContacto' value='<?= stripslashes($row['apellidoContacto']) ?>' /> 
<p><b>EmailContacto:</b><br /><input type='text' name='emailContacto' value='<?= stripslashes($row['emailContacto']) ?>' /> 
<p><b>TelefonoContacto:</b><br /><input type='text' name='telefonoContacto' value='<?= stripslashes($row['telefonoContacto']) ?>' /> 
<p><b>PaisContacto:</b><br /><input type='text' name='paisContacto' value='<?= stripslashes($row['paisContacto']) ?>' /> 
<p><input type='submit' value='Edit Row' /><input type='hidden' value='1' name='submitted' /> 
</form> 
<?php } ?> 


<?php include_once './footer.php'; ?>